package com.goldplusgold.database.lib;

import android.content.Context;


/**
 * @author guangming
 */
public class DatabaseCache {


    private static final byte[] LOCK = new byte[1];
    private static DatabaseCache sSingleton = null;

    protected DatabaseCache() {
    }

    public static DatabaseCache getInstance() {
        if (sSingleton == null) {
            synchronized (LOCK) {
                sSingleton = new DatabaseCache();
            }
        }

        return sSingleton;
    }

    public void initContext(Context ctx) {
        SQLiteOpenManager.initContext(ctx, "cache_db", 99);
    }

    public void initContext(Context ctx, String name, int version) {
        SQLiteOpenManager.initContext(ctx, name, version);
    }

    public synchronized void declareColumnsClass(ApiTableClazzDeclare clazz) {
        SQLiteOpenManager.getInstance().onCreateOrUpdateDatabaseTables(clazz.getTableClazzDeclare());
    }


}
